using System;
using Deepcode.Flux.Core.Codons;
using Deepcode.Flux.Core.Extensions;
using Deepcode.Flux.Core.Extensions.Codons;
using Deepcode.Flux.Core.Systems.UI.Taskpad;

namespace Deepcode.Flux.Core.Codons.Taskpad
{
	/// <summary>
	/// <Taskpad 
	///		id="padAddins" 
	///		title="Installed Addins" 
	///		ascx="~/admin/Menu/Taskpads/addins.ascx" 
	///		Permission="FluxGeneralAdmin"/>
	/// 
	/// Codon representing a taskpad to load.
	/// 
	/// </summary>
	[XmlCodonName("Taskpad")]
	public class TaskpadCodon : AbstractPermissionCodon
	{
		[XmlCodonAttribute("ascx")]
		private string ascx = "";
		[XmlCodonAttribute("title")]
		private string title = "";

		public override object BuildItem(object owner, System.Collections.ArrayList subItems)
		{
			if( !CheckUser() ) return null;

			TaskpadControl pad = new TaskpadControl( this.ID, title, ascx );
			return pad;
		}
	}
}
